import java.util.ArrayList;
import java.util.Arrays;

public class Test3 {
    public static void main(String[] args) {
        Student2 student1 = new Student2("zangsan",11);
        Student2 student2 = new Student2("lisi",13);
        Student2 student3 = new Student2("wangwu",14);

        //创建ArrayList对象
        ArrayList <Student2> list = new ArrayList<>();
        //添加三个对象
        list.add(student1);
        list.add(student2);
        list.add(student3);

        //使用增强for循环遍历
        for (Student2 x : list) {
            System.out.println(x);
        }
    }
}
